from selenium.webdriver.common.by import By
from lianxi.unittest.Base import Base
from time import sleep

class Page(Base):
    login_loc = (By.XPATH,'/html/body/div[1]/div/div[2]/ul/li[1]/a')
    def login(self):
        self.click(self.login_loc)
    dy1_loc = (By.XPATH,'/html/body/div[4]/div/div[1]/div[1]/span[1]')
    def dy1(self):
       return self.text(self.dy1_loc)
    #输入用户名
    username_loc = (By.NAME,'username')
    def username(self):
        self.send_keys(self.username_loc,'lkx')
    #输入密码
    password_loc = (By.NAME,'password')
    def password(self):
        self.send_keys(self.password_loc,'123456')
    #点击登录
    loginanniu_loc = (By.XPATH,'//*[@id="theForm"]/div[5]/a')
    def login_anniu(self):
         return self.click(self.loginanniu_loc)







    def luoji_A3mall(self):
        self.open_url('http://10.59.9.12:7001/')
        self.login()
        #等待
        sleep(5)
        #断言1
        print(self.dy1())
        #输入账号
        self.username()
        #输入密码
        self.password()
        sleep(10)
        #点击登录
        self.login_anniu()
        sleep(10)

